# Ruby 类和对象

# 在 Ruby 中定义类
class Customer

end

# Ruby 类中的变量

class Customer
  @@no_of_customers=0
end

# 在 Ruby 中使用 *new* 方法创建对象

cust1 = Customer.new
cust2 = Customer.new

# 自定义方法来创建 Ruby 对象

class Customer
  @@no_of_customers=0
  def initialize(id, name, addr)
    @cust_id=id
    @cust_name=name
    @cust_addr=addr
  end
end

cust1=Customer.new("1", "John", "Wisdom Apartments, Ludhiya")
cust2=Customer.new("2", "Poul", "New Empire road, Khandala")

puts cust1

# Ruby 类中的成员函数

#!/usr/bin/ruby

class Sample
  def hello
    puts "Hello Ruby!"
  end
end

# 使用上面的类来创建对象
object = Sample. new
object.hello